Method for handling interrupt request in optical storage drive

ABSTRACT

When an optical storage drive executes a control procedure or operation, a method of handling an interrupt request includes utilizing the optical storage drive to receive an interrupt request from a control circuit; checking whether the interrupt request is a read command; if the interrupt request is a read command, checking whether data indicated by the read command is in a buffer; and if the indicated data in the buffer, transferring the corresponding data to the control circuit from the buffer to respond to the interrupt request.

BACKGROUND

The invention relates to optical storage drives, and more particularly,to a method for handling an interrupt request in an optical storagedrive that executes a control procedure or an operation that needs along time.

As computer devices become more popular, the application of computerdevices is expanding. In addition to normal business use, personalcomputers are being used at home for providing functions such asmultimedia entertainment. Because multimedia entertainment involvesenormous audio and video streams for generating the needed visual andvoice effects, the development of data-storage technology has beenfurther promoted. One by one, many different kinds of data-storagedevices have appeared for storing the digital data more easily. Amongtheses data-storage devices, optical discs have been the preferred toolfor users to record data in recent years because of the low cost, smallvolume, and large capacity of optical discs. In addition to the data fornormal documents and programs, optical discs are also widely used forstoring multimedia data such as audio streams and video streams. Anoptical storage drive is used for accessing the data stored on theoptical discs.

Please refer to FIG.1, which is a diagram of an optical storage drive120 operating in coordination with a host 110 according to the relatedart. The optical storage drive 120 couples with the host 110 andreceives the control commands from the host 110 to operate. The opticalstorage drive 120 comprises a control circuit 122 that is used forcontrolling the operation of the optical storage drive 120.Additionally, a non-volatile storage memory 124 (such as Flash memory),a buffer 126 (such as the volatile RAM or the registers), and a servomodule 140 used for achieving the function of the optical storage drive120 are set up in the optical storage drive 120. The buffer 126 is usedfor temporarily storing the data that is needed during the operation ofthe optical storage drive 120. The servo module 140 comprises a spindlemotor 142, a pickup head 146, and other mechanical and electricaldevices. The spindle motor 142 is used for driving the optical disc 150to rotate. The pickup head 146 slides along a sliding track 144 toaccess data of different tracks in the optical disc 150.

Generally speaking, the host 110 sends the high-level control commandsto the control circuit 122 of the optical storage drive 120. The controlcircuit 122 executes the firmware program code 130 stored in thenon-violate storage memory 124 according to the control command. Thecontrol circuit 122 executes the corresponding control procedure storedin the firmware program code 130 for controlling the servo module 140 toexecute the main function of the optical storage drive 120.

For example, the host 110 sends a read command to the optical storagedrive 120 and assigns the address of the data in the optical disc 150when reading the data in the optical disc 150. And then the controlcircuit 122 executes the firmware program code 130 of the opticalstorage drive 120 for coordinating the operations of the spindle motor142, the pickup head 146, and other devices, such as controlling thespindle motor 142 to reach a specific rotational speed and moving thepickup head 146 to a pre-determined track for receiving reflected laserlight from the optical disc 150. The data that the servo module 140reads from the optical disc 150 is temporarily stored in the buffer 126and is then transferred to the host 110 using the control circuit 122.

Please refer to FIG. 2, which is a flowchart 200 of the optical storagedrive 120 reading data from the optical disc 150 according to a readcommand of the host 110 according to the related art. The flowchart 200comprises the following stops:

Step 202: The optical storage drive 120 utilizes the control circuit 122to receive and interpret a read command Instruction_A from the host 110.

Step 204: The optical storage drive 120 executes a read procedureaccording to the read command Instruction_A.

Step 206: The control circuit 122 is utilized to check whether dataindicated by the read command Instruction_A is stored in the buffer. Ifthe indicated data is stored in the buffer, go to step 212, if not, goto step 208.

Step 208: The control circuit 122 is utilized to execute the firmwareprogram code 130 for controlling the servo module 140 to execute seekingoperation.

Step 210: The servo module 140 is utilized to read the data indicated bythe read command Instruction_A in the optical disc 150 and totemporarily store the data in the buffer 126.

Step 212: The control circuit 122 is utilized to send the correspondingdata in the buffer 126 back to the host 110 for responding the readcommand.

Step 214: The read operation is finished.

The detailed operation of the optical storage drive 120 mentioned abovereading the data of the optical disc 150 according to a read commandfrom the host 110 is known by those skilled in the art. For brevity,further details are omitted here.

In general, after the host 110 sends a read command to the opticalstorage drive 120, the host 110 sends the next read command to theoptical storage drive 120 until the optical storage drive 120 returnsthe data indicated by the read command. When the host 110 needs a greatdeal of data from the optical disc 150 (ex: video data while playing theoptical disc 150), the host 110 continuously sends read commands to theoptical storage drive 120 for obtaining the data of the optical disc150.

In the related art, the optical storage drive 120 often utilizes thebuffer 126 to provide a cache function. For example, if the optical disc150 is a VCD, the data to be read by the host 110 is often continuousvideo data. After the optical storage drive 120 receives a read commandfrom the host 110, the optical storage drive 120 not only temporarilystores the data indicated by the read command in the buffer 126, butalso temporarily stores following data in the buffer 126 so that theoptical storage drive 120 is able to perform cache operation whenreceiving following read commands. This means that when the host 110sends the read command Instruction_A to the optical storage drive 120 instep 202, the optical storage drive 120 executes step 206 to firstexamine whether the data indicated by the read command Instruction_A isstored in the buffer 126 or not. If the data to be read is stored in thebuffer 126, control moves to step 212 for transferring the data in thebuffer 126 to the host 110 to respond the read command Instruction_A.The optical storage drive 120 doesn't need to read the data indicated bythe read command Instruction_A from the optical disc 150. Therefore, thespeed of the optical storage drive 120 responding to the host 110 isimproved.

In the related art, a data quantity threshold is usually set up in thebuffer 126 of the optical storage drive 120. After the optical storagedrive 120 fills up the buffer 126 to a specific level of the buffer. Thedata stored in buffer 126 is continuously transferred to the host 110because of the read commands send by the host 110. As long as the dataquantity in the buffer 126 is more than the data quantity threshold, theoptical storage drive 120 doesn't need to execute data-renewing. Whenthe data quantity in the buffer becomes equal to or lower than the dataquantity threshold, the optical storage drive 120 reads the followingdata from the optical disc 150 for filling up the data quantity of thebuffer 126 to the specific level.

Therefore, in step 206, if the related art judges that the dataindicated by the read command Instruction_A is stored in the buffer 126,it also determines whether the data quantity remaining after subtractingthe data indicated by the read command Instruction_A is equal to orlower than the data quantity threshold. If the control circuit 122judges that the remaining data quantity is equal to or lower than thedata quantity threshold of the buffer 126 after transferring the dataindicated by the read command lnstruction_A to the host 110, the controlcircuit 122 controls the servo module 140 for reading the following dataof the optical disc 150 and temporarily storing the data in the bufferto fill up the data quantity to the specific level of the buffer 126according to the main loops of the firmware program code 130.

Before reading the data of the optical disc 150, the optical storagedrive 120 has to execute a seeking operation to move the pickup head 146to an appropriate position. The seeking operation is a procedure ofmoving the pickup head 146 along the sliding track 144 to a track thatthe data to be read belongs to. The executing time of the seekingoperation is usually from several microseconds (ms) to 100 microseconds.A long-seeking operation will spend a multiple of the seeking time. Theoptical storage drive 120 utilizes the cache function provided by thebuffer 126 to smooth the procedure of data transferring. Only if thedata to be read is not in the buffer 126, or only if parts of the datato be read are in the buffer 126 and the other part of the data to beread have to be read from the optical disc 150, will the optical storagedrive 120 have to execute the seeking operation of step 208.

However, in the structure of the firmware program code 130 of theoptical storage drive 120 according to the related art, when the opticalstorage drive 120 executes the seeking operation of step 208 accordingto the main loop of the firmware program code 130, if the opticalstorage drive 120 receives a read command Instruction_B send by the host110, the interrupt request will be generated. After accepting parametersof command, the interrupt request will be temporarily paused. Only whenthe control circuit 122 has completed the routine procedure (step 208)according to the main loop of the firmware program code 130 will theoptical storage drive 120 respond to the interrupt request to interpretand handle the read command Instruction_B. Actually, not only in theseeking operation, but the interrupt request is also paused in allhandling methods of the interrupt request when the optical storage drive120 executes a control procedure or operation that needs a long time inthe structure of the firmware program code 130. After the procedure oroperation completed, the optical storage drive 120 executes the newinterrupt procedure. For example, the operations of normal opticalstorage drives such as modulating the rotating speed of the spindlemotor 142, retrying, and so on, are all control procedures or operationsthat need a long time.

As known in the related art, the responding speed of the optical storagedrive 120 to a read command is much faster than the speed of the opticalstorage drive 120 executing a seeking operation. For example, the speedof the host 110 transferring data through the IDE or SCSI bus interfaceis 10 M bytes/second, but the data length requested by each read commandsend by the host 110 is 20 k bytes. This means that the response time ofthe optical storage drive 120 to a read command is only 2 milliseconds(ms).

In other words, if the host 110 sends the read command Instruction_B tothe optical storage drive 120 during executing the control procedure oroperation that needs a longer time in the optical storage drive 120, theread command Instruction_B is responded to after the optical storagedrive 120 completes the preceding procedure. So, even if the dataindicated by the read command Instruction_B is stored in the buffer 126,the optical storage drive 120 still has to wait until the controlprocedure or operation is completed and then the optical storage drive120 responds to the interrupt request. This means the host 110 may causedelays due to the interruption of data. For example, in the related art,when the host 110 utilizes the optical storage drive 120 to read thedata of a VCD for playing a video, if the data that the host 100 needsis interrupt, a severe problem such as a delay could occur.

In order to reduce the influence of a delay, the prior applies the StateMachine method of the program design to design the firmware program code130. The State Machine method divides the control procedure or operationthat needs a long time of the optical storage drive 120 into many stagesfor executing. So, the time of each state may be much lower, and theoptical storage drive 120 can utilize the interval of states to handlethe interrupt request corresponding to the read command send by the host110 for reducing the time of the read command waiting to be responded.

However, the firmware program code where the State Machine method isutilized is a little complicated so that the difficulties and the costof updating and maintaining the firmware program code increases. Itfurther influences the timing of products getting into the market.

SUMMARY

It is therefore an objective of the claimed invention to provide amethod for parallel handling of a control procedure or operation thatneed a long time and an interrupt request to solve the above-mentionedproblem.

According to the present invention, a method is disclosed for handlingan interrupt request in an optical storage drive when the opticalstorage drive executes a control procedure or operation. The methodincludes utilizing the optical storage drive to receive an interruptrequest from a control circuit; checking whether the interrupt requestis a read command; if the interrupt request is a read command, checkingwhether data indicated by the read command is stored in a buffer; and ifthe indicated data is stored in the buffer, transferring thecorresponding data to the control circuit from the buffer to respond tothe interrupt request.

Also disclosed according to the claimed invention, a storage medium forstoring program code used to control an optical storage drive to performthe following steps while executing a control procedure or operation:receiving an interrupt request from a control circuit; checking whetherthe interrupt request is a read command; if the interrupt request is aread command, checking whether data indicated by the read command isstored in a buffer; and if the indicated data is stored in the buffer,transferring the corresponding data to the control circuit from thebuffer to respond to the interrupt request.

One advantage of the present invention is that the optical storage drivecan handle the read command when an interrupt request occurs. Therefore,the optical storage drive can quickly respond to the read command sentfrom the host when executing a control procedure or operation that needsa long time. The problem of data delay is thereby improved.

Another advantage of the present invention is that there is no need toutilize the State Machine method to design the firmware program code sothat the complexity of the firmware program code is lowered and theconvenience of maintaining and updating is increased.

These and other objectives of the present invention will no doubt becomeobvious to those of ordinary skill in the art after reading thefollowing detailed description of the preferred embodiment that isillustrated in the various figures and drawings.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a diagram of an optical storage drive operating incoordination with a host according to the related art.

FIG. 2 is a flowchart of an optical storage drive reading data on anoptical disc according to a read command of a host according to therelated art.

FIG. 3 is a diagram of an optical storage drive operating incoordination with a host according to the present invention.

FIG. 4 is a flowchart of an optical storage drive handling an interruptrequest when executing a control procedure or an operation that needs along time.

DETAILED DESCRIPTION

Please refer to FIG.3, which is a diagram of an optical storage drive320 operating in coordination with a host 110 according to the presentinvention. The optical storage drive 320 and the optical storage drive120 in FIG.1 are similar. Therefore, the same device is labeled with thesame number. Additionally, the devices of the optical storage drive 320are connected in the same way as those of the optical storage drive 120.For brevity, repeated details are omitted here.

The difference between the optical storage drive 320 in the presentinvention and the optical storage drive 120 lies in that the method ofthe firmware program code 330 of the optical storage drive 320 handlingan interrupt request when the optical storage drive 320 executes acontrol procedure or operation that needs a long time is different fromthe related art. The operation of the firmware program code 330 isillustrated as follows.

FIG. 4 is a flowchart 400 of an optical storage drive 320 handling aninterrupt request when executing a control procedure or an operationthat needs a long time. The flowchart 400 comprises the following steps:

Step 402: The optical storage drive 320 receives a command lnstruction_Cand generates an interrupt request when executing a control procedure oroperation that needs a long time (such as the seeking operation,modulating the spindle motor 142, and so on).

Step 404: The control circuit 122 interprets the command lnstruction_Ccorresponding to the interrupt request.

Step 406: The control circuit 122 is utilized to judge whether thecommand Instruction_C is a read command. If the command lnstruction_C isa read command, go to step 408. If the command lnstruction_C is not aread command, go to step 414.

Step 408: The buffer 126 is checked to determine whether it contains thedata indicated by the read command. If the data indicated by the readcommand is in the buffer 126, step 410 is performed. If the dataindicated by the read command is not in the buffer 126, step 414 isperformed.

Step 410: The control circuit 122 is utilized to transfer the dataindicated by the read command in the buffer 126 to the host 110.

Step 412: The control circuit 122 eliminates the interrupt request.

Step 414: The firmware program code 330 returns to the main loop thatwas originally executed.

Preferably, the optical storage drive 320 utilizes the method forhandling an interrupt request of the present invention when executing acontrol procedure or operation that needs a long time for making theprocedure of the optical storage drive 320 transferring the data of theoptical disc 150 to the host 110 smoother. In order to further explainthe operation of the flowchart 400, as an example, assume that theoptical storage drive 320 executes the seeking operation. Please noticethat the method for handling an interrupt request of the presentinvention is not limited to be applied while the optical storage driveexecutes the seeking operation. In fact, the method for handling aninterrupt request of the present invention can be applied while theoptical storage drive executes various control procedure or operation.

Continuing the above example, when handling a read commandInstruction_A, the optical storage drive 320 checks whether the dataindicated by the read command Instruction_A is stored in the buffer 126and judges whether the data quantity of the buffer 126 will be equal toor lower than a pre-determined data quantity threshold after subtractingthe data indicated by the read command Instruction_A. Therefore, theoptical storage drive 320 in one aspect utilizes the control circuit 122to transfer the data corresponding to the read command Instruction_A inthe buffer 126 to the host 110. In another aspect, the control circuit122 of the optical storage drive 320 controls the servo module 140 forexecuting a routine procedure (seeking operation) to make the opticalstorage drive 320 read the following data of the optical disc 150 andtemporarily store the following data in the buffer 126 according to themain loop of the firmware program code 330.

However, the consuming time of the optical storage drive 320transferring the data indicated by the read command Instruction_A to thehost 110 is usually much shorter than that of the optical storage drive320 executing a seeking operation. Thus, the host 110 has probablyhandled the data indicated by the read command Instruction_A and hassent another read command lnstruction_C to the optical storage drive 320for reading the following data before controlling the servo module 140of the optical storage drive 320 for completing the seeking operation.

Therefore, in step 402, when the control circuit 122 of the opticalstorage drive 320 monitors the seeking operation of the servo module140, the control circuit 122 receives the command Instruction_C sentfrom the host 110 and generates an interrupt request. And then, in step404 after the interrupt request is generated, the control circuit 122immediately interprets the command lnstruction_C corresponding to theinterrupt request.

In step 406, after the control circuit 122 interprets the commandInstruction_C, the control circuit 122 determines whether the commandlnstruction_C is a read command or not. If the command lnstruction_Csent from the host 110 is not a read command, the control circuit 122first handles the preceding seeking operation and then responds to thecommand based on the priority of the command. The command Instruction_Cis herein assumed to be a read command to illustrate the followingsteps.

In step 408, after the control circuit 122 judges that the commandInstruction_C is a read command, the control circuit 122 checks whetherthe data indicated by the read command lnstruction_C is stored in thebuffer 126.

If the data indicated by the read command lnstruction_C is not stored inthe buffer 126, it means that the optical storage drive 320 has to readdata from the optical disc 150. The servo module 140, however, isexecuting the seeking operation and cannot start another seekingoperation. The read command lnstruction_C has to wait until the seekingoperation is completed or to stop the seeking operation immediately.After the preceding seeking operation is completed, the read commandlnstruction_C is checked to decide whether it needs to be executed.Because the purpose of the preceding seeking operation of the servomodule 140 is to read the following data of the optical disc 150 tosupply the data quantity of the buffer 126, if the data read by theroutine procedure and the read command lnstruction_C are the same, orthe data to be read by the routine procedure contains the data to beread by the read command Instruction_C, the optical storage drive 320does not need to execute the seeking operation again according to theread command Instruction_C.

In another aspect, if only a part of the data indicated by the readcommand Instruction_C is stored in the buffer 126, in an embodiment ofthe present invention, the control circuit 122 first transfers the partof the data in the buffer 126 back to the host 110 and the remainingdata indicated by the read command lnstruction_C waits until the servomodule 140 completed the seeking operation. In another embodiment of thepresent invention, the control circuit 122 waits until the whole dataindicated by the read command lnstruction_C is ready and then transfersthe data to the host 110.

Additionally, in step 408, if the data indicated by the read commandInstruction_C is stored in the buffer 126, the control circuit 122 willproceed to step 410.

In step 410, the control circuit 122 transfers the data indicated by theread command lnstruction_C in the buffer 126 to the host 110 at the sametime as executing the seeking operation. It is equal to parallelhandling of the seeking operation and responding to the read commandInstruction_C. In the control circuit 122, the circuit for monitoringseeking operation of the servo module 140 and the circuit fortransmitting data to the host 110 are different and have no conflicts.Thus, the two parallel operations do not cause adversely functionaleffect to the optical storage drive 320. Therefore, the operation of thehost 110 is able to avoid from delaying by the data interruption.

After the control circuit 122 transferred all the data indicated by theread command lnstruction_C to the host 110, the control circuit 122proceeds to step 412 and clears the interrupt request corresponding tothe read command Instruction_C.

In step 414, the flow of the firmware program code 330 that the controlcircuit 122 executes returns to the original preceding main loop. Asmentioned above, since the execution time of the seeking operation ismore than that required for transferring the data to the host 110, theservo module 140 might not have finished the seeking operation when thecontrol circuit 122 has finished responding to the read commandInstruction_C.

Similarly, if the servo module 140 has not finished the seekingoperation but the host 110 has finished processing the data indicated bythe read command lnstruction_C and sent another read commandInstruction_D to the optical storage drive 320, the control circuit 120will repeat step 404 to step 412 to immediately respond to the readcommand Instruction_D.

As such, according to the present invention, the method for handling aninterrupt request when the optical storage drive 320 executes a controlprocedure or operation that needs a longer time does not interrupt theoriginal proceeding control procedure and operation and immediatelyresponds to the read command sent from the host 110. Because thefirmware program code 330 according to the present invention does notuse the State Machine programming method, there is no need to divide thecontrol procedure or operation that needs a long time into severalstates. This means the complexity of the firmware program code 330 ismuch lower than related art.

Additionally, when an interrupt request occurs, the control circuit 122only needs to use a few operating cycles to interpret the commandcorresponding to the interrupt request. So, as soon as the command isdetermined not to be a read command and the command need not to responsevery soon, the control circuit 122 will temporarily not handle it sothat the operation of the servo module 140 will not be influenced. Ifthe command is a read command, the control circuit 122 only needs toeasily check whether the data indicated by the command is in the buffer126 or not. If the data indicated by the command is not stored in thebuffer 126, the control circuit will temporarily not handle the command.If the data indicated by the command is stored in the buffer 126, thecontrol circuit 122 will transfer the data to the host 110. Because thecircuit that controls the servo module 140 in the control circuit 122and the circuit responsible to transfer data to the host 110 in thecontrol circuit 122 have no conflicts, the normal operation of the servomodule 140 is not influenced.

Oppositely, the optical storage drive 120 of the related art utilizingthe control circuit 122 to interpret and respond to the correspondingcommand after the servo module 140 completes the proceeding seekingoperation might have data operation adversely affected by the host 110because of the data interrupt.

The method according to the present invention not only increases thesmoothness of transferring data of an optical disc (such as a VCD)between the optical storage drive 320 and the host 110, but also lowersthe complexity and the cost of maintaining and updating the firmwareprogram code 330 because there is no need to use a State Machineprogramming method.

Those skilled in the art will readily observe that numerousmodifications and alterations of the device may be made while retainingthe teachings of the invention. Accordingly, the above disclosure shouldbe construed as limited only by the metes and bounds of the appendedclaims.

1. A method for handling an interrupt request in an optical storagedrive when the optical storage drive executes a control procedure oroperation, the method comprising: utilizing the optical storage drive toreceive an interrupt request from a control circuit after execution ofthe control procedure or operation has begun; checking whether theinterrupt request corresponds to a read command; when the interruptrequest corresponds to a read command, checking whether data indicatedby the read command is stored in a buffer; and when the indicated datais stored in the buffer, transferring the corresponding data to thecontrol circuit from the buffer to respond to the interrupt request inparallel with the execution of the control procedure or operation. 2.The method of claim 1, wherein the buffer is a volatile memory of theoptical storage drive.
 3. The method of claim 1, wherein the buffer is aregister of the optical storage drive.
 4. The method of claim 1, whereinthe control circuit is a host computer.
 5. The method of claim 1,further comprising: if the data indicated by the read command is notstored in the buffer, suspending handling the interrupt request.
 6. Astorage medium for storing program code used to control an opticalstorage drive to perform the following steps while executing a controlprocedure or operation: receiving an interrupt request from a controlcircuit; checking whether the interrupt request corresponds to a readcommand; when the interrupt, request corresponds to a read command,checking whether data indicated by the read command is stored in abuffer; and when the indicated data is stored in the buffer,transferring the corresponding data to the control circuit from. thebuffer to respond to the interrupt request in parallel with theexecution of the control procedure or operation.
 7. The storage mediumof claim 6 being a non-volatile memory.
 8. A method for handling aninterrupt request in an optical storage drive when the optical storagedrive executes a control procedure or operation, the method comprising:providing a control circuit comprising a first control circuit and asecond control circuit; utilizing the optical storage drive to controlthe first control circuit to perform a seeking operation; receiving aninterrupt request; checking whether the interrupt request corresponds toa read command; when the interrupt request corresponds to a readcommand, checking whether data indicated by the read command is storedin a buffer; and when the indicated data is Stored in the buffer,utilizing the second control circuit to transfer the corresponding datafrom the buffer to respond to the interrupt request in parallel with thefirst control circuit executing the control procedure or operation. 9.The method of claim 1, wherein the buffer is a volatile memory of theoptical storage drive.
 10. The method of claim 1, wherein the buffer isa register of the optical storage drive.
 11. The method of claim 1,wherein the control circuit is a host computer.
 12. The method of claim1, further comprising: if the data indicated by the read command is notstored in the buffer, suspending handling die interrupt request.
 13. Astorage medium for storing program code used to control an opticalstorage drive to perform the following steps while executing a controlprocedure or operation: receiving an intermit request from a controlcircuit. The control circuit comprising a first control circuit and asecond control circuit; checking whether the interrupt requestcorresponds to a read command; when the interrupt request corresponds toa read command, checking whether data indicated by the read command isstored in a buffer; and when the indicated data is stored in the buffer,utilizing the second control circuit to transfer the corresponding datato the control circuit front the buffer to respond to the interruptrequest; wherein the control procedure or operation is executed by thefirst control circuit, and the second control circuit transforms thedata in parallel with the execution of the control procedure oroperation.
 14. The storage medium of claim 6 being a non-volatilememory.